public class GuessNumber {

    public int guessNumber(int n) {
        int l = 1;
        int r = n;
        while (l < r) {
            int mid = l + (r - l) / 2;
            int guess = guess(mid);
            if (guess == 1) {
                l = mid + 1;
            } else if (guess == -1) {
                r = mid;
            } else return mid;
        }
        return l;
    }

    int guess(int num) {
        return 0;
    };
}
